package com.devin.job;

import com.devin.model.dto.ChatMessage;
import com.devin.model.enums.MessageType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.scheduling.annotation.Scheduled;

import java.util.Date;

@Configuration
public class MyJob {

    @Autowired
    private SimpMessagingTemplate simpMessagingTemplate;
//
   /* @Scheduled(fixedRate = 5000)
    public void sendMessage(){
        System.out.println("来自于服务段的消息");
        ChatMessage chatMessage = new ChatMessage();
        chatMessage.setSender("devin");
        chatMessage.setContent("test");
        chatMessage.setType(MessageType.CHAT);
        simpMessagingTemplate.convertAndSend("/topic/10","hello world");

    }
*/
 /*   @Scheduled(fixedRate = 5000)
    public void sendQueueMessage() {
        System.out.println("后台一对一推送！");
        simpMessagingTemplate.convertAndSendToUser("1","/sendMessage",new Date());
    }*/
}
